package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.ReceiveProductRecord;
import com.sc.nft.mapper.ReceiveProductRecordMapper;
import  com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

/**
 * 免费领取商品记录(sc_receive_product_record)数据DAO
 *
 * @author zxy
 * @since 2023-10-18 19:47:49
 * @description 
 */
@Slf4j
@Repository
public class ReceiveProductRecordDao extends ServiceImpl<ReceiveProductRecordMapper, ReceiveProductRecord> {


    public Integer getReceivedCount(Long productId,Long userId){
        LambdaQueryWrapper<ReceiveProductRecord> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(ReceiveProductRecord::getProductId,productId);
        wrapper.eq(ReceiveProductRecord::getUserId,userId);
        return count(wrapper);
    }
}